<template>
  <div class="foot">
    Copyright©2022 | <a style='color: #2db7f5' target="_blank" href="https://beian.miit.gov.cn">豫ICP备15014923号-1 </a>|
    浏览量：<span id="busuanzi_value_site_pv"><i class="fa fa-spinner fa-spin"></i></span>👀 | 访客数：<span id="busuanzi_value_site_uv"><i class="fa fa-spinner fa-spin"></i></span>👦
    <span style="margin-left: 10px"><router-link to="/disclaimer">免责申明</router-link></span>
    <p style="margin-top: 4px">本站已运行: {{ totalDays }}天{{ yuHours }}小时{{ yuMinutes }}分{{ yuSeconds }}秒</p>
    <p>欢迎来自{{returnCityIp.cname}}的朋友，您的IP是: {{returnCityIp.cip}}， 您使用的是:{{osAndBrowser}}</p>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data () {
    return {
      osAndBrowser: null,
      totalDays:'',
      yuHours:'',
      yuMinutes:'',
      yuSeconds:'',
      returnCityIp:{},
    }
  },
  created () {
  },
  mounted(){
    this.runTime();
    this.osAndBrowser = this.getOSAndBrowser();
    this.getUserIP();
  },
  methods: {
    /**
     * 获取时间
     */
    runTime(){
      let rantime = '2022/3/28 00:00:00:000'
      setInterval(() => {
        let startTime = new Date(rantime);
        let nowTime = new Date();
        let timestamp = (nowTime.getTime() - startTime.getTime());
        let oneDayMilliseconds = 24 * 60 * 60 * 1000;
        let totalDaysTmp = timestamp / oneDayMilliseconds;
        this.totalDays = Math.floor(totalDaysTmp);
        let yuHoursTmp = (totalDaysTmp - this.totalDays) * 24;
        this.yuHours = Math.floor(yuHoursTmp);
        let yuMinutesTmp = (yuHoursTmp - this.yuHours) * 60;
        this.yuMinutes = Math.floor((yuHoursTmp - this.yuHours) * 60);
        this.yuSeconds = Math.floor((yuMinutesTmp - this.yuMinutes) * 60);
      }, 1000);
    },
    /**
     * 获取当前系统和浏览器版本
     * @returns {string}
     */
    getOSAndBrowser(){
      let os = navigator.platform;
      let userAgent = navigator.userAgent;
      let info = "";
      let tempArray = "";
      if (os.indexOf("Win") > -1) {
        if (userAgent.indexOf("Windows NT 5.0") > -1) {
          info += "Win2000"
        } else if (userAgent.indexOf("Windows NT 5.1") > -1) {
          info += "WinXP"
        } else if (userAgent.indexOf("Windows NT 5.2") > -1) {
          info += "Win2003"
        } else if (userAgent.indexOf("Windows NT 6.0") > -1) {
          info += "WindowsVista"
        } else if (userAgent.indexOf("Windows NT 6.1") > -1 || userAgent.indexOf("Windows 7") > -1) {
          info += "Win7"
        } else if (userAgent.indexOf("Windows NT 6.2") > -1 || userAgent.indexOf("Windows 8") > -1) {
          info += "Win8"
        } else if (userAgent.indexOf("Windows NT 6.3") > -1 || userAgent.indexOf("Windows 8.1") > -1) {
          info += "Win8.1"
        } else if (userAgent.indexOf("Windows NT 10.0") > -1 || userAgent.indexOf("Windows 10") > -1) {
          info += "Win10"
        } else {
          info += "Other"
        }
      } else if (os.indexOf("Mac") > -1) {
        info += "Mac"
      } else if (os.indexOf("X11") > -1) {
        info += "Unix"
      } else if (os.indexOf("Linux") > -1) {
        info += "Linux"
      } else {
        info += "Other"
      }
      info += "/";
      let isOpera = userAgent.indexOf("Opera") > -1;
      let isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera;
      let isEdge = userAgent.toLowerCase().indexOf("edge") > -1 && !isIE;
      let isIE11 = (userAgent.toLowerCase().indexOf("trident") > -1 && userAgent.indexOf("rv") > -1);
      if (/[Ff]irefox(\/\d+\.\d+)/.test(userAgent)) {
        tempArray = /([Ff]irefox)\/(\d+\.\d+)/.exec(userAgent);
        info += tempArray[1] + tempArray[2]
      } else if (isIE) {
        let version = "";
        let reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        let fIEVersion = parseFloat(RegExp["$1"]);
        if (fIEVersion === 7) {
          version = "IE7"
        } else if (fIEVersion === 8) {
          version = "IE8"
        } else if (fIEVersion === 9) {
          version = "IE9"
        } else if (fIEVersion === 10) {
          version = "IE10"
        } else {
          version = "0"
        }
        info += version
      } else if (isEdge) {
        info += "Edge"
      } else if (isIE11) {
        info += "IE11"
      } else if (/[Cc]hrome\/\d+/.test(userAgent)) {
        tempArray = /([Cc]hrome)\/(\d+)/.exec(userAgent);
        info += tempArray[1] + tempArray[2]
      } else if (/[Vv]ersion\/\d+\.\d+\.\d+(\.\d)* *[Ss]afari/.test(userAgent)) {
        tempArray = /[Vv]ersion\/(\d+\.\d+\.\d+)(\.\d)* *([Ss]afari)/.exec(userAgent);
        info += tempArray[3] + tempArray[1]
      } else if (/[Oo]pera.+[Vv]ersion\/\d+\.\d+/.test(userAgent)) {
        tempArray = /([Oo]pera).+[Vv]ersion\/(\d+)\.\d+/.exec(userAgent);
        info += tempArray[1] + tempArray[2]
      } else {
        info += "unknown"
      }
      return info
    },
    /**
     * 获取当前用户的IP地址
     */
    // getUserIp(){
    //   this.$http({
    //     url: this.$http.adornUrl('/ip-address/info'),
    //     method: 'get'
    //   }).then(({data}) => {
    //     if (data && data.status === 0) {
    //       console.log(data,90000000000)
    //     }
    //   })
    // },
    getUserIP() {
      this.returnCityIp = returnCitySN;
    }
  }
}
</script>


<style lang="stylus" rel="stylesheet/stylus">
   .foot{
     height: 70px
     color: #2db7f5
     font-size: 12px
     text-align center
   }

</style>
